// config.h: interface for the CLConfig class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CONFIG_H__B4480902_DBAA_41F3_A830_F7F52608B345__INCLUDED_)
#define AFX_CONFIG_H__B4480902_DBAA_41F3_A830_F7F52608B345__INCLUDED_

#include "str.h"
#include "file.h"
	
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CLConfig 
{
	CLStrConf	m_conf;
	CLStr		m_file;
public:
	static LPCSTR default_sep_chars;
	static LPCSTR default_rem_chars;

	int save(LPCSTR filename="",LPCSTR sep=" = ");
	int save(const CLFile& f,LPCSTR sep=" = ");
	int continue_line(const CLStr& line);
	int load(LPCSTR filename, LPCSTR sep=NULL);

	CLConfig(LPCSTR filename="", LPCSTR sep=NULL);
	~CLConfig() {}
	void set(LPCSTR sec,LPCSTR key,LPCSTR val) { m_conf.set(sec,key,val); }
	CLStr get(LPCSTR sec,LPCSTR key,LPCSTR def="") const { CLStr val=m_conf.get(sec,key); if(val.empty()) return def; else return val; }
};

#endif // !defined(AFX_CONFIG_H__B4480902_DBAA_41F3_A830_F7F52608B345__INCLUDED_)
